/**
 * 
 */

$(window).load(function() {

	$(function() {
		collage();
	});
});

// Here we apply the actual CollagePlus plugin
function collage() {
	$('.Collage').removeWhitespace().collagePlus({
		'fadeSpeed' : 500,
		'targetHeight' : 200,
		'allowPartialLastRow' : true
	});
};
// This is just for the case that the browser window is resized
var resizeTimer = null;
$(window).bind('resize', function() {
	// hide all the images until we resize them
	$('.Collage .Image_Wrapper').css("opacity", 0);
	$winWidth = $(window).width();

	// set a timer to re-apply the plugin
	if (resizeTimer)
		clearTimeout(resizeTimer);
	resizeTimer = setTimeout(collage, 200);
});

$(document).ready(
		function() {

			$("#betalife_slide").owlCarousel({
				paginationSpeed : 1000,
				rewindSpeed : 1000,
				slideSpeed : 8000,
				singleItem : true,
				autoPlay : true,
				autoPlay : 10000,
				navigation : false,
				autoHeight : true
			});

			/* team */
			$('.main .team_btn li').each(
					function(index) {
						$(this).bind(
								{

									mouseenter : function() {
										$i = $('.profile');
										$(this).find($i).css('display',
												'inline-block').fadeTo("fast",
												0.9);
										/*	$(this).find($i).animate({top: "-230px"},'fast',"linear");*/

									},

									mouseleave : function() {
										$(this).find($i).fadeOut(200);
										/*$(this).find($i).animate({top: "+230px"},'fast',"linear");*/

									}

								});
					})

			$('#firstpage img').css('display', 'block').css('opacity', 0.5);
			$('#firstpage img').each(function(index) {
				$(this).bind({
					mouseenter : function() {

						$(this).fadeTo("200", 1);
					},
					mouseleave : function() {

						$(this).fadeTo('200', 0.5);

					}
				})
			})

			$('#page_works .Image_Wrapper').each(
					function(index) {

						$(this).bind(
								{
									mouseenter : function() {
										$j = $('.Wrapper_BG');
										$h = $('.img_wrap');

										$(this).find($j).css('display',
												"inline-block").fadeTo("fast",
												0.9);
									},
									mouseleave : function() {

										$(this).find($j).fadeOut(200);

									}
								})

					})
			$(".btn-menu").click(function() {
				$(".menu").toggle(function() {
					$(this).css('height', '110');
				});

			})

		});
